package com.heima.user.controller.v1;

import com.heima.model.common.dtos.PageRequestDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.user.service.ApUserRealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/api/v1/auth")
public class ApUserController {

    @Autowired
    private ApUserRealService apUserRealService;

    @PostMapping("/list")
    public ResponseResult list(@RequestBody PageRequestDto dto) {
        return apUserRealService.listApUserReal(dto);
    }

    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody Map<String,String> map) {
        String id = map.get("id");
        return apUserRealService.authPass(id);
    }

    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody Map<String,String> map) {
        String id = map.get("id");
        String msg = map.get("msg");
        return apUserRealService.authFail(id,msg);
    }
}
